/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author has
 */
@Entity
@Table(name = "komentarbarang", catalog = "onsale", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Komentarbarang.findAll", query = "SELECT k FROM Komentarbarang k"),
    @NamedQuery(name = "Komentarbarang.findByIdKomentarBarang", query = "SELECT k FROM Komentarbarang k WHERE k.idKomentarBarang = :idKomentarBarang"),
    @NamedQuery(name = "Komentarbarang.findByNamaKomentarBarang", query = "SELECT k FROM Komentarbarang k WHERE k.namaKomentarBarang = :namaKomentarBarang"),
    @NamedQuery(name = "Komentarbarang.findByEmailKomentarbarang", query = "SELECT k FROM Komentarbarang k WHERE k.emailKomentarbarang = :emailKomentarbarang"),
    @NamedQuery(name = "Komentarbarang.findByKomentarKomentarBarang", query = "SELECT k FROM Komentarbarang k WHERE k.komentarKomentarBarang = :komentarKomentarBarang")})
public class Komentarbarang implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idKomentarBarang", nullable = false)
    private Integer idKomentarBarang;
    @Column(name = "namaKomentarBarang", length = 25)
    private String namaKomentarBarang;
    @Column(name = "emailKomentarbarang", length = 25)
    private String emailKomentarbarang;
    @Column(name = "komentarKomentarBarang", length = 500)
    private String komentarKomentarBarang;
    @JoinColumn(name = "idBarang", referencedColumnName = "idBarang", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Barang idBarang;

    public Komentarbarang() {
    }

    public Komentarbarang(Integer idKomentarBarang) {
        this.idKomentarBarang = idKomentarBarang;
    }

    public Integer getIdKomentarBarang() {
        return idKomentarBarang;
    }

    public void setIdKomentarBarang(Integer idKomentarBarang) {
        this.idKomentarBarang = idKomentarBarang;
    }

    public String getNamaKomentarBarang() {
        return namaKomentarBarang;
    }

    public void setNamaKomentarBarang(String namaKomentarBarang) {
        this.namaKomentarBarang = namaKomentarBarang;
    }

    public String getEmailKomentarbarang() {
        return emailKomentarbarang;
    }

    public void setEmailKomentarbarang(String emailKomentarbarang) {
        this.emailKomentarbarang = emailKomentarbarang;
    }

    public String getKomentarKomentarBarang() {
        return komentarKomentarBarang;
    }

    public void setKomentarKomentarBarang(String komentarKomentarBarang) {
        this.komentarKomentarBarang = komentarKomentarBarang;
    }

    public Barang getIdBarang() {
        return idBarang;
    }

    public void setIdBarang(Barang idBarang) {
        this.idBarang = idBarang;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idKomentarBarang != null ? idKomentarBarang.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Komentarbarang)) {
            return false;
        }
        Komentarbarang other = (Komentarbarang) object;
        if ((this.idKomentarBarang == null && other.idKomentarBarang != null) || (this.idKomentarBarang != null && !this.idKomentarBarang.equals(other.idKomentarBarang))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Komentarbarang[ idKomentarBarang=" + idKomentarBarang + " ]";
    }
    
}
